package pppp.hhhh.redisdemo.mapper;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import pppp.hhhh.redisdemo.entity.User;

public interface UserMapper {
    @Select("SELECT * FROM user WHERE id = #{id}")
    User getUserById(Long id);

    @Insert("INSERT INTO user(username, email, age) VALUES(#{username}, #{email}, #{age})")
    void insertUser(User user);

    @Update("UPDATE user SET username = #{username}, email = #{email}, age = #{age} WHERE id = #{id}")
    void updateUser(User user);

    @Delete("DELETE FROM user WHERE id = #{id}")
    void deleteUser(Long id);
}
